                import { ElMessage, ElMessageBox } from "element-plus";
import {  ElNotification } from 'element-plus'
const msg = (type, text) => {
  ElMessage({
    message: text,
    type: type,
  });
}
const notify = (type = 'success', text = '操作成功！', title = '提示') => {
  ElNotification({
    message: text,
    type: type,
    title
  });
}
const confirmMsg = (msg = '确认删除当前项？', title = "提示", isReason) => {
  return new Promise((resolve, reject) => {
    if (!isReason) {
      ElMessageBox.confirm( msg, title, {
        confirmButtonText: '确认',
        cancelButtonText: '取消',
        type: 'warning',
      }).then(() => {
        resolve(true);
      }).catch(() => {
        reject(false);
      })
    } else {
      ElMessageBox.prompt(msg, title, {
        confirmButtonText: "驳回",
        cancelButtonText: "取消",
      }).then(({ value }) => {
        resolve(value);
      }).catch(() => {
        reject(false);
      });
    }
  })
}

export default {
  msg,
  notify,
  confirmMsg
}